package com.pureut.retrospect.controller;

import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.retrospect.service.ProductTraceabilityService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: YSL
 * @Date: 2023/4/13 10:02
 * @Desc: 产品追溯
 */
@RestController
@RequestMapping("/productTraceability")
public class ProductTraceabilityController {

    /**
     * 产品追溯
     */
    @Resource
    private ProductTraceabilityService productTraceabilityService;

    /**
     * 基础信息
     * @param codingType, wsiMaterialNumber
     * @return
     */
    @GetMapping("/getProductTraceabilityList")
    public AjaxResult getProductTraceabilityList(String codingType, String wsiMaterialNumber) {
        return AjaxResult.success(productTraceabilityService.getProductTraceabilityList(codingType, wsiMaterialNumber));
    }

    /**
     * 品检信息
     * @param wsiMaterialNumber
     * @return
     */
    @GetMapping("/getProductQualityTemporaryList")
    public AjaxResult getProductQualityTemporaryList(String codingType, String wsiMaterialNumber) {
        return AjaxResult.success(productTraceabilityService.getProductQualityTemporaryList(codingType, wsiMaterialNumber));
    }

    /**
     * 同批次信息
     * @param wsiMaterialNumber
     * @return
     */
    @GetMapping("/getProductSameBatchList")
    public AjaxResult getProductSameBatchList(String codingType,String wsiMaterialNumber) {
        return AjaxResult.success(productTraceabilityService.getProductSameBatchList(codingType,wsiMaterialNumber));
    }

    /**
     * 产品追溯
     * @param wsiMaterialNumber
     * @return
     */
    @GetMapping("/getProductPersonalDetails")
    public AjaxResult getProductPersonalDetails(String codingType, String wsiMaterialNumber) {
        return AjaxResult.success(productTraceabilityService.getProductPersonalDetails(codingType, wsiMaterialNumber));
    }

    /**
     * 追溯信息
     * @param wsiMaterialNumber
     * @return
     */
    @GetMapping("/getTraceabilityInformationList")
    public AjaxResult getTraceabilityInformationList(String codingType, String wsiMaterialNumber) {
        return AjaxResult.success(productTraceabilityService.getTraceabilityInformationList(codingType, wsiMaterialNumber));
    }

    /**
     *  根据小卷查询小卷信息
     * @param materialNumber
     * @return
     */
    @GetMapping("/getTraceabilityRollInfo")
    public AjaxResult getTraceabilityRollInfo(String materialNumber) {
        return AjaxResult.success(productTraceabilityService.getTraceabilityRollInfo(materialNumber));
    }


}

